[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Manipulators I/O Setting Manipulators
The manipulators are predefined words that you can pass to
cin, cout, cerr, or clog to change the formatting of the data to
follow. For example, hex is a manipulator and cout<<hex; changes
stdout to hexadecimal format (include IOMANIP.H). Here are the
manipulators and their uses:
dec outs<<dec or ins>>dec Sets decimal conversion flag.
hex outs<<dec or ins>>dec Sets hex conversion flag.
oct outs<<dec or ins>>dec Sets octal conversion flag.
ws ins>>ws Remove whitespace chars.
endl outs<<endl Insert newline, flush stream.
ends outs<<ends Insert null to end string.
flush outs<<flush Flush an output stream.
setbase(int) outs<<setbase(nn) Set conversion base to nn.
resetioflags(long) ins>>resetioflags(ll) Clear format bits in the
or streams as indicated by ll.
outs<<resetioflags(ll)
setfill(int) ins>>setfill(nn) Set fill character to nn.
or
outs<<setfill(nn)
setprecision(int) ins>>setprecision(nn) Set precision to nn digits.
or
outs<<setprecision(nn)
setw(int) ins>>setw(nn) Set field width to nn.
or
outs<<setw(nn)
See Also:
Formatting
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson